const app = getApp();
Page({
  data: {
    background: [],
    backgrounds: [],
    indicatorDots: true,
    autoplay: true,
    interval: 3000,
    circular: true,
    data: [],
    datas: []
  },
  onLoad() {
    var that = this;
    my.httpRequest({
      url: 'https://zfbzzbj.chuangkegf.com/public/index.php/api/flink/get_slide',
      method: 'POST',
      data: {},
      dataType: 'json',
      success: function (res) {
        if (res.status == 200) {
          that.setData({
            background: res.data.data.up,
            backgrounds: res.data.data.down
          });
        } else {
          my.alert({ content: '网络错误！请稍后重试' });
        }
      },
      fail: function (res) {
        my.alert({ content: '网络错误！请稍后重试' });
      }
    });
    my.httpRequest({
      url: 'https://zfbzzbj.chuangkegf.com/public/index.php/api/flink/get_demand_info',
      method: 'POST',
      data: {},
      dataType: 'json',
      success: function (res) {
        if (res.status == 200) {
          that.setData({
            data: res.data.data.up,
            datas: res.data.data.down
          });
        } else {
          my.alert({ content: '网络错误！请稍后重试' });
        }
      },
      fail: function (res) {
        my.alert({ content: '网络错误！请稍后重试' });
      }
    });
  },
  details(e) {
    my.navigateTo({
      url: '../details/details?id=' + e.target.dataset.id + "&title=" + e.target.dataset.title
    })
  }
});
